<%--
  Created by IntelliJ IDEA.
  User: 宋晓博
  Date: 2022/1/16
  Time: 18:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>订单预览</title>
    <link type="text/css" rel="stylesheet" href="static/bootstrap-3.4.1-dist/css/bootstrap.css"/>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ include file="header.jsp" %>
    <style>
        .zuokuai {padding-bottom: 12px;background-color: #f5f5f5;margin-left: -15px;}
    </style>
</head>

<body>
<script type="text/javascript" src="static/bootstrap-3.4.1-dist/js/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="static/bootstrap-3.4.1-dist/js/bootstrap.js"></script>
<script type="text/javascript" src="static/js/order.js"></script>
<div class="container">

    <div class="row">
        <div class="col-md-2">
            <ul class="nav nav-sidebar zuokuai">
                <li><a href="#">个人中心</a></li>
                <li><a href="#">收藏夹</a></li>
                <li><a href="#">购物车</a></li>
                <li><a href="#">历史足迹</a></li>
            </ul>
            <ul class="nav nav-sidebar zuokuai">
                <li><a href="">全部订单</a></li>
                <li><a href="">待付款</a></li>
                <li><a href="">待发货</a></li>
                <li><a href="">待收货</a></li>
                <li><a href="">待评价</a></li>
                <li><a href="">已完成</a></li>
            </ul>
            <ul class="nav nav-sidebar zuokuai">
                <li><a href="">收获地址</a></li>
                <li><a href="">物流查询</a></li>
                <li><a href="">我的评价</a></li>
            </ul>
        </div>
        <div class="col-md-10 main">
            <h2 class="sub-header">订单预览：</h2>
            <form action="order" method="get">
                <input type="hidden" name="method" value="add">
                <div class="table-responsive">
                    <table class="table table-striped">

                        <thead>
                            <tr>
                            <th width="120px">序号</th>
                            <th>商品名称</th>
                            <th width="30%">商品型号</th>
                            <th>价格</th>
                            <th>数量</th>
                            <th>小计</th>
                        </tr>
                        </thead>

                        <tbody>
                            <c:forEach items="${requestScope.items}" var="item" varStatus="i">
                                <tr>
                                    <td>${i.count}</td>
                                    <td>
                                        ${item.goods.name}
                                        <input type="hidden" name="gid" value="${item.goods.id}">
                                    </td>
                                    <td><small>${item.goods.info}</small></td>
                                    <td>${item.goods.price}</td>
                                    <td>${item.num}</td>
                                    <td>${item.goods.price*item.num}</td>
                                </tr>
                            </c:forEach>

                            <tr>
                                <td><p>选择收货地址:</p></td>
                                <td colspan="5">

                                    <select name="useraddress" class="form-control" id="address" style="width: 80%;height: 30px;border-radius: 6px;border: 1px solid #337ab7">
                                        <c:if test="${empty requestScope.addreslist}">
                                            <option value="0">尚未创建收货地址</option>
                                        </c:if>

                                        <c:if test="${!empty requestScope.addreslist}">

                                            <c:forEach items="${requestScope.addreslist}" var="item" varStatus="i">
                                                <c:if test="${item.defaults==0}">
                                                    <option value="${item.aid}">${item.content}-${item.uname}-${item.utel}</option>
                                                </c:if>

                                                <c:if test="${item.defaults==1}">
                                                    <option value="${item.aid}" selected>(当前默认)${item.content}-${item.uname}-${item.utel}</option>
                                                </c:if>
                                            </c:forEach>
                                        </c:if>

                                    </select>
                                    <br>
                                    <p>
                                        <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal">添加收获地址</button>
                                    </p>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="5" align="right"><h4>总价：</h4></td>
                                <td><h4><b>${requestScope.total}</b></h4></td>
                            </tr>
                        </tbody>
                    </table>
                </div>

                <div class="row">
                    <div class="pull-right" style="margin-right: 40px;">
                            <input type="submit" class="btn btn-primary btn-md "id="addorder" value="提交订单">
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<%--${requestScope.addreslist}--%>
    <%--模态框--%>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">

            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="exampleModalLabel">创建一个收获地址</h4>
            </div>

            <form action="order" method="get" id="addressfrom">
                <div class="modal-body">

                    <div class="form-group">
                        <div class="col-md-1">
                            <label style="margin: 6px 0px">省:</label>
                        </div>

                        <div class="col-md-3">
                            <select name="province" class="form-control">
                                <option value="0">下拉选择</option>
                                <c:forEach items="${requestScope.sys_province}" var="province">
                                    <option value="${province.id}">${province.name}</option>
                                </c:forEach>
                            </select>
                        </div>
                        <div class="col-md-1">
                            <label style="margin: 6px 0px">市：</label>
                        </div>

                        <div class="col-md-3">
                            <select name="city" class="form-control">
                                <option>下拉选择</option>
                            </select>
                        </div>

                        <div class="col-md-1">
                            <label style="margin: 6px 0px">区：</label>
                        </div>
                        <div class="col-md-3">
                            <select name="area" class="form-control">
                                <option>下拉选择</option>
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label">详细地址:</label>
                        <textarea class="form-control" name="detail" rows="2" placeholder="小区楼栋/乡村名称"></textarea>
                    </div>



                    <div class="form-group">
                        <label class="control-label">收货人</label>
                        <input type="text" name="uname" class="form-control" placeholder="名字">
                    </div>

                    <div class="form-group">
                        <label class="control-label">手机号:</label>
                        <input type="number" name="utel" class="form-control" placeholder="手机号">
                    </div>

                </div>

                <div class="form-group" style="padding-left: 15px">
                    <label>
                        <input type="checkbox" name="setdefault" value="yes">
                        <font color="#ff4500">设为默认</font>
                    </label>
                </div>

<%--                <input type="hidden" name="method" value="add" id="hidebutton">--%>

                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="reset" class="btn btn-default">清空</button>
                    <button type="submit" class="btn btn-primary">提交</button>
                </div>

            </form>
        </div>
    </div>
</div>
</body>
</html>
